package com.ygq.seckill.util;

import org.springframework.util.StringUtils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 通过正则表达式 检验手机号的类
 */
public class ValidatorUtil {

    //矫正手机号的正则表达式
    private static final Pattern mobile_pattern=Pattern.compile("^[1][3-9][0-9]{9}");

    public static Boolean isMobile(String mobileNums){
        if(!StringUtils.hasText(mobileNums)){
            return false;
        }
        Matcher matcher = mobile_pattern.matcher(mobileNums);
        return matcher.matches();
    }
}
